home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / bbs / msged_10.zip / DORINFO.MEX next >
Text File  |  1997-07-03  |  3KB  |  87 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Important!  Change line 46 to suit your needs.
  3. //
  4. // File: dorinfo.mex
  5. //
  6. // Desc: DORINFOx.DEF generation program
  7. //
  8. // Copyright 1990, 1994 by Lanius Corporation.  All rights reserved.
  9. // Unfortunaly I had to break the copy right by changing the file.
  10. // Lanius shouldn't reserve all rights on the misc files that come with 
  11. // Maximus, because they provide an excellent framework.
  12. //////////////////////////////////////////////////////////////////////////////
  13. #include <max.mh>
  14. #include <prm.mh>
  15. // get_firstlast takes 'name' and splits it into the two
  16. // components 'first' and 'last'.  This is typically used to
  17. // split the sysop or user's name into two parts for various
  18. // external programs.
  19.  
  20. void get_firstlast(string: name, ref string: first, ref string: last)
  21. {
  22.     int: space;
  23.     space:=strfind(name, " ");
  24.     if (space = 0)
  25.     {
  26.       first := name;
  27.       last := "   ";
  28.     }
  29.     else
  30.     {
  31.       first := substr(name, 1, space-1);
  32.       last := substr(name, space+1, strlen(name)-space+1);
  33.     }
  34. }
  35.  
  36.  
  37. // Write the DORINFOx.DEF file for this task
  38. int main(string: opt)
  39. {
  40.     string: file;           // Name of file to write
  41.     string: first, last;    // First/last names of user/sysop
  42.     //string: buf;
  43.     int: fd;                // Handle for file functions
  44.     int: priv;              // Numeric xBBS-style priv level
  45.     // Construct the filename to use   
  46.     file:="D:\\bbs\\doors\\dorinfo" + itostr(id.task_num) + ".def";
  47.     // Try to create the file
  48.     fd:=open(file, IOPEN_CREATE | IOPEN_WRITE);
  49.     if (fd=-1)
  50.     {
  51.         log("!Couldn't create " + file);
  52.         return 1;
  53.     }
  54.     // Now write all of the necessary information to the drop file.
  55.     writeln(fd, prm_string(PRM_SYSNAME));      // BBS name
  56.     get_firstlast(prm_string(PRM_SYSOP), first, last); // Sysop name
  57.     writeln(fd, first);             // Sysop first name
  58.     writeln(fd, last);              // Sysop last name
  59.     if (id.local)                   // COM port
  60.         writeln(fd, "COM0");
  61.     else if(strtoi(opt) = 0)
  62.         writeln(fd, "COM" + itostr(id.port));
  63.     else if(strtoi(opt) <> 0)
  64.     {
  65.         writeln(fd, "COM" + opt);
  66.     }
  67.     writeln(fd, ltostr(id.speed) + " BAUD,N,8,1"); // line parameters
  68.     writeln(fd, " 0");              // Not networked
  69.     get_firstlast(usr.name, first, last);
  70.     writeln(fd, strupper(first));   // User's first name
  71.     writeln(fd, strupper(last));    // User's last name
  72.     writeln(fd, usr.city);          // User's city
  73.     if (usr.video=0)
  74.         writeln(fd, "0");           // No graphics
  75.     else
  76.         writeln(fd, "1");           // ANSI or AVATAR
  77.     // Now write user's numeric priv level and number of
  78.     // minutes remaining.
  79.     writeln(fd, itostr(usr.priv));  // Privilege level
  80.     writeln(fd, itostr(timeleft()));// Time limit
  81.     writeln(fd, "-1");              // -1 means we have a FOSSIL
  82.     close(fd);
  83.     return 0;
  84. }
  85.  
  86.  
  87.